import {WorkStationProps} from '@/interface/workstation';
import {makeAutoObservable} from 'mobx';

class GraphStore {
    editDialogVisible: boolean;
    workStationProps: WorkStationProps;
    curNodeId: string;

    constructor() {
        this.editDialogVisible = false;
        this.curNodeId = '';
        this.workStationProps = {
            number: null,
            username: '',
            status: 1
        };
        makeAutoObservable(this);
    }

    setEditDialogVisible(bool: boolean) {
        this.editDialogVisible = bool;
    }

    setCurNodeId(id: string) {
        this.curNodeId = id;
    }

    setWorkStationProps(changedValues: keyof WorkStationProps) {
        Object.assign(this.workStationProps, changedValues);
    }

    resetWorkStationProps() {
        this.workStationProps.number = null;
        this.workStationProps.username = '';
        this.workStationProps.status = 1;
    }
}

export default new GraphStore();
